package org.flatshare.entity;

import java.util.GregorianCalendar;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.*;

import org.flatshare.util.InvoiceType;

/**
 * Entity implementation class for Entity: Invoice
 *
 */
@Entity
@Table(name="INVOICE")
@NamedQueries( {
@NamedQuery(name = "findAllInvoices", query = "select i from Invoice i"),
@NamedQuery(name = "findByIdInvoices", query = "select i from Invoice i  where i.id = :id"),
@NamedQuery(name = "findByTypeInvoices", query = "select i from Invoice i  where i.type = :type")	})


public class Invoice implements Serializable {

	
	private static final long serialVersionUID = 1L;
	@Id
	@Column(name="INVOICE_ID")
	private String id;

	@Column(name="INVOICE_TYPE")
	@Enumerated(EnumType.STRING)
	private InvoiceType type;
	
	@Column(name="INVOICE_AMOUNT")
	private float amount;
	
	@Column(name="START_DATE")
	@Temporal(TemporalType.DATE)
	private Date startDate;
	
	@Column(name="END_DATE")	
	@Temporal(TemporalType.DATE)
	private Date endDate;

	@ManyToMany(cascade = CascadeType.ALL)
	@JoinTable(name= "INVOICE_ROOMER",
				joinColumns = {@JoinColumn(name="INVOICE_ID", table="INVOICE")},
				inverseJoinColumns = {@JoinColumn(name= "ROOMER_ID", table="ROOMER")})
		private List<Roomer> roomers;
	

	
	public List<Roomer> getRoomers() {
		return roomers;
	}

	public void setRoomers(List<Roomer> roomers) {
		this.roomers = roomers;
	}

	public Invoice() {
		super();
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public InvoiceType getType() {
		return type;
	}

	public void setType(InvoiceType type) {
		this.type = type;
	}

	public float getAmount() {
		return amount;
	}

	public void setAmount(float amount) {
		this.amount = amount;
	}

	public Date  getStartDate() {
		return startDate;
	}

	public void setStartDate(Date  startDate) {
		this.startDate = startDate;
	}

	public Date  getEndDate() {
		return endDate;
	}

	public void setEndDate(Date  endDate) {
		this.endDate = endDate;
	}


	
	
   
}
